Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nested property setting #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

runningskull
Copy link

get()ing nested properties using dot-notation works, so it seems logical that it should work during set() as well. I needed it today, so implemented it.

It behaves like a mkdir -p, creating objects along the path if they don't exist. The other option is to throw in error in that case. I haven't thought through the pros/cons of each.

If this is a desired feature, I'll happily add some tests & polish it up.

EDIT: fixed a bug


// split property on '.' access
// and dig into the object
do {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a for loop without shift to improve performance.

@defunctzombie
Copy link
Contributor

Any prior art with other view/bindings frameworks and what they do? This seems like a reasonable feature.

@yanatan16
Copy link
Contributor

👍 lgtm

@defunctzombie
Copy link
Contributor

Can merge after tests added.

@defunctzombie defunctzombie changed the title [needs tests] Add nested property setting Add nested property setting Aug 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants